﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lcmyjobs.Web.Admin
{
    public partial class AdminLogin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string name = this.txtName.Text.Trim();
                string pwd = this.txtPwd.Text.Trim();
                string checkcode = this.txtCode.Text.Trim();
                if (Session["CheckCode"] != null)
                {
                    if (checkcode.ToUpper() == Session["CheckCode"].ToString())
                    {
                        lcmyjobs.BLL.admininfo bad = new BLL.admininfo();
                        pwd = myPublic.GetMd5(pwd);

                        int id = bad.AdminLogin(name,pwd,1);
                        if (id != 0)
                        {
                            //Session["user"] = Bp.GetModel(id);
                            Session["adminlogin"] = id;
                            Response.Redirect("LoginList.aspx");
                        }
                        else
                            Maticsoft.Common.MessageBox.Show(this,"用户名或密码不对！");

                    }
                    else
                        Maticsoft.Common.MessageBox.Show(this, "验证码不对！");
                }
                else
                    Maticsoft.Common.MessageBox.Show(this, "验证码不对！");

            }
        }
    }
}